package com.zhenhunfan;

import com.zhenhunfan.service.HelloServiceImpl;
import com.zhenhunfan.service.TestServiceImpl;
import io.grpc.Server;
import io.grpc.ServerBuilder;

/**
 * <p>Title:</p>
 * <p>Description:</p>
 *
 * @author zhanghong
 * @date 2023/7/17
 */
public class GrpcServer1 {
    public static void main(String[] args) throws Exception {
        //1.绑定端口
        ServerBuilder serverBuilder = ServerBuilder.forPort(9000);
        //2.发布服务
        serverBuilder.addService(new HelloServiceImpl());
        serverBuilder.addService(new TestServiceImpl());
        //3.创建服务对象
        Server server = serverBuilder.build();
        server.start();
        server.awaitTermination();
    }
}
